/**
 * problem_048.cpp
 * Copyright (C) 2011 - xrose
 */

#include <iostream>
#include <string>
#include <math.h>
#define dec10 10000000000

using namespace std;

long long int _10lastdigit(int n)
{
	long long int npower = 1;
	for(int i = 0; i < n; i++)
	{
		npower *= n;
		npower = npower%dec10;
	}
	return npower;
}
int main (int argc, char const* argv[])
{
	long long int abc = 0;
	for(int i = 1; i<=1000; i++)
	{
	    abc+=_10lastdigit(i);
	}
	abc=abc%dec10;
	cout<<abc<<endl;
    return 0;
}
